/* 
 * File:   CS325Project3EntryClassTest.cpp
 * Author: Cody TV Weber
 *
 * Created on Mar 26, 2014, 12:16:37 PM
 */

#include <stdlib.h>
#include <iostream>
#include "Entry.h"

/*
 * Simple C++ Test Suite
 */

void testEntry() {
    Entry * orig = new Entry("hello");
    Entry * entry = new Entry((*orig));
    if (entry->GetWord() != "hello") {
        std::cout << "%TEST_FAILED% time=0 testname=testEntry (CS325Project3EntryClassTest) message=error message sample" << std::endl;
    }
    cout << entry->GetWord() << endl;
}

void testAddAHamPercentage() {
    double percentage = .05;
    Entry * entry = new Entry("hello");
    entry->addAHamPercentage(percentage);
    if (entry->GetPercentageInHam() != 0.05) {
        std::cout << "%TEST_FAILED% time=0 testname=testAddAHamPercentage (CS325Project3EntryClassTest) message=error message sample" << std::endl;
        cout << entry->GetPercentageInHam() << endl;
    } else {
        cout << entry->GetPercentageInHam() << endl;
    }
}

void testAddASpamPercentage() {
    double percentage = .05;
    Entry * entry = new Entry("hello");
    entry->addASpamPercentage(percentage);
    if (entry->GetPercentageInSpam() != 0.05) {
        std::cout << "%TEST_FAILED% time=0 testname=testAddASpamPercentage (CS325Project3EntryClassTest) message=error message sample" << std::endl;
        cout << entry->GetPercentageInSpam() << endl;
    } else {
        cout << entry->GetPercentageInSpam() << endl;
    }
}

int main(int argc, char** argv) {
    std::cout << "%SUITE_STARTING% CS325Project3EntryClassTest" << std::endl;
    std::cout << "%SUITE_STARTED%" << std::endl;

    std::cout << "%TEST_STARTED% testEntry (CS325Project3EntryClassTest)" << std::endl;
    testEntry();
    std::cout << "%TEST_FINISHED% time=0 testEntry (CS325Project3EntryClassTest)" << std::endl;

    std::cout << "%TEST_STARTED% testAddAHamPercentage (CS325Project3EntryClassTest)" << std::endl;
    testAddAHamPercentage();
    std::cout << "%TEST_FINISHED% time=0 testAddAHamPercentage (CS325Project3EntryClassTest)" << std::endl;

    std::cout << "%TEST_STARTED% testAddASpamPercentage (CS325Project3EntryClassTest)" << std::endl;
    testAddASpamPercentage();
    std::cout << "%TEST_FINISHED% time=0 testAddASpamPercentage (CS325Project3EntryClassTest)" << std::endl;

    std::cout << "%SUITE_FINISHED% time=0" << std::endl;

    return (EXIT_SUCCESS);
}

